<div class="layui-side layui-bg-black">
	<div class="layui-side-scroll">
		<#include "/apps/business/xiaoe/include/left.html">
	</div>
</div>
<div class="layui-body">
	<div class="layui-side-scroll">
		<div class="row" style="height:100%;">
			<div class="col-lg-3" style="border-right:1px solid #e6e6e6;padding-right:0px;">
				<h1 class="site-h1" style="background-color:#FFFFFF;">
					词库类型
					<span style="float:right;">
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/words/type/add.html" data-toggle="ajax" data-height="240" data-width="550" data-title="新建分类">
							新建分类
						</button>
					</span>
				</h1>
				<div class="row">
					<div class="col-lg-12">
						<ul>
							<li class="uk_role  <#if !curtype??>this</#if>"">
								<a href="/apps/xiaoe/words.html">
									<i class="kfont">&#xe61d;</i>
									默认
								</a>
							</li>
							<#if wordsTypeList??>
							<#list wordsTypeList as wordsType>
							<li class="uk_role <#if wordsType?? && wordsType.id == curtype.id>this</#if>">
								<a href="/apps/xiaoe/words.html?type=${wordsType.id!''}">
									<i class="kfont">&#xe7d0;</i>
									${wordsType.name!''}
								</a>
							</li>
							</#list>
							</#if>
						</ul>
					</div>
				</div>
			</div>
			<div class="col-lg-9">
				<h1 class="site-h1" style="background-color:#FFFFFF;">
					“<#if curtype??>${curtype.name!''}<#else>默认</#if>”词库下的词条列表<#if wordsList??>（${wordsList?size}）</#if>
					<div class="ukefu-bt-text-content" style="position: absolute;right: 5px;top: 0px;">
						<#if curtype??>
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/words/type/edit.html<#if curtype??>?type=${curtype.id}</#if>" data-toggle="ajax" data-width="550" data-height="240" data-title="编辑分类">
							编辑分类
						</button>
						<button class="layui-btn layui-btn-sm layui-btn-danger" href="/apps/xiaoe/words/type/delete.html<#if curtype??>?id=${curtype.id!''}&type=${curtype.id}</#if>" data-toggle="tip" data-title="删除分类后，该类下的词条会合并到默认分类下，请确认是否删除？">
							删除分类
						</button>
						</#if>
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/words/reload.html<#if curtype??>?type=${curtype.id}</#if>" data-toggle="tip" data-title="请确认是否重新加载词库？">
							重新加载词库
						</button>
						<!-- <button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/words/add.html<#if curtype??>?type=${curtype.id}</#if>" data-toggle="ajax" data-width="950" data-height="500" data-title="添加词条">
							添加分类下的词条
						</button> -->
						<a class="layui-btn layui-btn-sm layui-btn-danger" id="batdel" href="javascript:void(0)">
							批量删除词条
						</a>
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/words/batadd.html<#if curtype??>?type=${curtype.id}</#if>" data-toggle="ajax" data-width="950" data-height="500" data-title="添加词条">
							批量创建词条
						</button>
						<#if curtype?? && curtype.code?? && curtype.code == "topic">
						<a class="layui-btn layui-btn-sm layui-btn-danger" id="batdel" href="/apps/xiaoe/words/loadtopic.html<#if curtype??>?type=${curtype.id}</#if>">
							加载主题词
						</a>
						<a class="layui-btn layui-btn-sm layui-btn-danger" id="batdel" href="/apps/xiaoe/words/unloadtopic.html<#if curtype??>?type=${curtype.id}</#if>">
							卸载主题词
						</a>
						<#elseif !(curtype??) || !(curtype.code??) || curtype.code != "ambiguity">
						<a class="layui-btn layui-btn-sm layui-btn-danger" id="batdel" href="/apps/xiaoe/words/batcheck.html<#if curtype??>?type=${curtype.id}</#if>">
							检查词库
						</a>
						</#if>
						
						
					</div>
				</h1>
				<div class="row" style="padding:5px;">
					<div class="col-lg-12">
						<table class="layui-table" lay-skin="line">
							<thead>
							<tr>
								<th style="width:1%">	
									<input type="checkbox" value="1" onclick="$('.ids').prop('checked',$(this).prop('checked'))">
								</th>
							  	<th style="width:60%">关键词</th>
							  <!-- <th>创建时间</th> -->
							  <th style="white-space:nowrap;" nowrap="nowrap" style="width:1%">操作</th>
							</tr> 
						  </thead>
						  <tbody>
						  	<#if wordsList??>
							<#list wordsList as words>
							<tr>
								<td class="ukefu_topic_title">
									<input type="checkbox" name="ids" class="ids" value="${(words.keyword!'')?url}">
							  </td>
							  <td class="ukefu_topic_title">
									${words.keyword!''}
							  </td>
							  <!-- <td class="ukefu_topic_title">
									${words.createtime?string("yyyy-MM-dd HH:mm:ss")}
							  </td> -->
							  <td style="white-space: nowrap;width:1%;">
							  		<a href="/apps/xiaoe/words/edit.html?word=${(words.keyword!'')?url}<#if curtype??>&type=${curtype.id}</#if>" data-toggle="ajax" data-width="550" data-height="220">
							  			<i class="layui-icon">&#xe642;</i>
							  			编辑
							  		</a>
							  		<a href="/apps/xiaoe/words/delete.html?word=${(words.keyword!'')?url}<#if curtype??>&type=${curtype.id}</#if>" data-toggle="tip" data-title="请确认是否删除词条？">
							  			<i class="layui-icon" style="color:red;">ဆ</i>
							  			移除
							  		</a>
							  </td>
							  </tr>
							</#list>
							</#if>
						</table>
					</div> 	   
				</div>
				<div class="row" style="padding:5px;">
					<div class="col-lg-12" id="page" style="text-align:center;"></div>
				</div>
			</div>	
		</div>
	</div>
</div>
<script>
	$(document).ready(function(){
		$('#batdel').click(function(){
			var ids = "";
			var num = 0 ;
			$('.ids').each(function(){
				if($(this).prop("checked")){
					if(ids!= ""){
						ids += ","  ;
					}
					ids += $(this).val();
					num++;
				}
			});
			if(num>0){
				top.layer.confirm("请确认是否删除选中词条？",{icon: 3, title:'提示'}, function(index){
					top.layer.close(index);
					location.href='/apps/xiaoe/words/batdelete.html?type=${curtype.id!''}&word='+ids ;
				});
			}else{
				top.layer.alert("请先选择需要删除的词条");
				$('#batdel').attr("href" , "javascript:void(0)");
			}
		});
		
	});
</script>
